package com.cse333.jester;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.MediaMetadataRetriever;
import android.widget.ImageView;
import com.cse333.jester1.R;

public class CurrentTrack {
	private static String path;
	private static Bitmap albumArt;
	private static String album;
	private static String artist;
	private static String title;
	
	
	public CurrentTrack(String path){
		this.path = path;
		MediaMetadataRetriever mmr = new MediaMetadataRetriever();
		mmr.setDataSource(path);
		albumArt = BitmapFactory.decodeByteArray(mmr.getEmbeddedPicture(),0,mmr.getEmbeddedPicture().length);
		album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
		artist = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
		title = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
		
	}
	
	
	public void setCurrentTrack(String path){
		this.path = path;
		MediaMetadataRetriever mmr = new MediaMetadataRetriever();
		mmr.setDataSource(path);
		albumArt = BitmapFactory.decodeByteArray(mmr.getEmbeddedPicture(),0,mmr.getEmbeddedPicture().length);
		album = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
		artist = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
		title = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
		
	}


	public static String getPath() {
		return path;
	}


	public static void setPath(String path) {
		CurrentTrack.path = path;
	}


	public static Bitmap getAlbumArt() {
		return albumArt;
	}


	public static void setAlbumArt(Bitmap albumArt) {
		CurrentTrack.albumArt = albumArt;
	}


	public static String getAlbum() {
		return album;
	}


	public static void setAlbum(String album) {
		CurrentTrack.album = album;
	}


	public static String getArtist() {
		return artist;
	}


	public static void setArtist(String artist) {
		CurrentTrack.artist = artist;
	}


	public static String getTitle() {
		return title;
	}


	public static void setTitle(String title) {
		CurrentTrack.title = title;
	}
	
	
	

}
